import xlrd
import random
excel = xlrd.open_workbook("未知玻璃.xlsx")
st = excel.sheet_by_index(0)
li = list(st.get_rows())
l11 = [0.2187, 1.320434, 0.6404, 0.7365, 22.08478, 9.001739, 0.26826]
l12 = [9.33083, 5.3325, 1.079, 1.93167, 0.4117, 0.5983, 0.04167]
l21 = [0.126, 2.6904, 44.418, 11.9872, 5.4444, 0.4252]
l22 = [0.5114, 1.14857, 2.2443, 1.0443, 0.397, 0.0357]
l31 = [17.0513, 0.18133]
l32 = [31.5225, 0.43125]
l41 = [5.932, 2.426, 2.36]
l42 = [11.7586, 7.4086, 0.71857]
f1 = [1.599504, 1.300535]
f2 = [0.046543, 0.173276, 0.478965]
n3 = [10, 13]
n4 = [4, 5, 12]
n1 = [4, 5, 6, 8, 10, 11, 13]
n2 = [4, 5, 10, 11, 12, 13]
for f in range(10):
    lst = []
    for i in range(8):
        a = 0
        b = 0
        ct = []
        if li[i+1][1].value == '无风化':
            for m in range(7):
                x = random.uniform(0.9, 1.1)
                p = li[i+1][n1[m]].value
                ct.append(p*x)
            for j in range(7):
                a += (ct[j]-l11[j])**2
                b += (ct[j]-l12[j])**2
            if a > b:
                c = []
                a1 = 0
                b1 = 0
                for y in range(3):
                    z = random.uniform(0.9, 1.1)
                    d = li[i+1][n4[y]].value
                    c.append(d*z)
                for e in range(3):
                    a1 += (c[e]-l41[e])**2
                    b1 += (c[e]-l42[e])**2
                if a1 > b1:
                    lst.append(22)
                elif a1 < b1:
                    lst.append(21)
            elif a < b:
                c = []
                a1 = 0
                b1 = 0
                for y in range(2):
                    z = random.uniform(0.9, 1.1)
                    d = li[i+1][n3[y]].value
                    c.append(d*z)
                for e in range(2):
                    a1 += (c[e]-l31[e])**2
                    b1 += (c[e]-l32[e])**2
                if a1 > b1:
                    lst.append(12)
                elif a1 < b1:
                    lst.append(11)
        elif li[i+1][1].value == '风化':
            for m in range(6):
                x = random.uniform(0.9, 1.1)
                p = li[i+1][n2[m]].value
                ct.append(p*x)
            for j in range(6):
                a += (ct[j]-l21[j])**2
                b += (ct[j]-l22[j])**2
            if a > b:
                c = []
                a1 = 0
                b1 = 0
                for y in range(3):
                    z = random.uniform(0.9, 1.1)
                    d = li[i+1][n4[y]].value
                    c.append(d*z)
                for e in range(3):
                    a1 += (c[e]-l41[e])**2/f2[e]
                    b1 += (c[e]-l42[e])**2/f2[e]
                if a1 > b1:
                    lst.append(22)
                elif a1 < b1:
                    lst.append(21)
            elif a < b:
                c = []
                a1 = 0
                b1 = 0
                for y in range(2):
                    z = random.uniform(0.9, 1.1)
                    d = li[i+1][n3[y]].value
                    c.append(d*z)
                for e in range(2):
                    a1 += (c[e]-l31[e])**2/f1[e]
                    b1 += (c[e]-l32[e])**2/f1[e]
                if a1 > b1:
                    lst.append(12)
                elif a1 < b1:
                    lst.append(11)
    print(lst)
